package com.finance.cooperate.dao.support.jpa;

import com.finance.cooperate.dao.support.constant.DeleteStatus;
import com.finance.cooperate.dao.support.pojo.BaseAutomaticSimpleVO;

import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import java.util.Date;

/**
 * @ClassName EntitySimpleListener
 * @Description TODO
 * @Author shen
 * @Date 2022/5/25 16:20
 * @Modify ...
 */
public class EntitySimpleListener {

    /***
     * @Author shen
     * @Description 保存前处理
     * @Date 7:10 下午 2020/10/23
     * @Param [entity]
     * @return void
     **/
    @PrePersist
    public void prePersist(BaseAutomaticSimpleVO entity) {

        entity.setCreateTime(new Date());
        entity.setUpdateTime(new Date());

    }


    /***
     * @Author shen
     * @Description 更新前处理
     * @Date 7:12 下午 2020/10/23
     * @Param [entity]
     * @return void
     **/
    @PreUpdate
    public void preUpdate(BaseAutomaticSimpleVO entity) {
        entity.setUpdateTime(new Date());
    }
}
